<?php

/**
 * 后台文章操作模型
 */
class ArticleModel extends Model {
	/**
	 * 添加文章
	 * @param array $art 文章信息
	 */
	public function insertArt($art) {
		//通过数组得到多个变量
		extract($art);
		//完善其他数据
		//$thumb = 'default.jpg';
		$addtime = time();
		//入库
		$sql ="insert into bg_article values(null,$cate_id,'$title','$thumb','$art_desc','$content','
		$author',default,$addtime,default)";
		return $this->dao->my_query($sql);
	}
	/**
	 * 获取所有文章的信息
	 */
	public function getArticle() {
		$sql = "select a.*,c.cate_name from bg_article as a left join bg_category as c on a.cate_id = c.cate_id where is_del ='0' order by addtime desc";
		return $this->dao->fetchAll($sql);
	}
}
